﻿@model IEnumerable<Fap.Workflow.Model.WfBusiness>

<title><fap-multilang lang-key="agent_task" default-content="代理任务"></fap-multilang></title>
<div class="row">
    <div class="col-xs-12">
        <div class="row">
            <div class="col-xs-12">
                @foreach (var bizGrp in Model.GroupBy(b => b.BizTypeUidMC))
                {
                    <h4 class="smaller lighter green">@bizGrp.Key</h4>

                    <ul class="list-inline bizprocess nav nav-pills">
                        @foreach (var biz in bizGrp.AsEnumerable())
                        {
                            <li>
                                <a href="javascript:void(0)" data-business="@biz.Fid" data-bill="@biz.BillEntity">
                                    <i class="ace-icon fa fa-suitcase green bigger-110"></i>
                                    @biz.BizName <i class="text-danger">@(biz.Exp.ToString() == "0" ? "" : $"+{biz.Exp}")</i>

                                </a>
                            </li>
                        }
                    </ul>
                }

            </div>
        </div>
        <hr />
        <div class="row">
            <div class="col-xs-12" id="bizContent">
                @*动态加载待处理列表*@
                <div class="col-xs-1"></div>
                <div class="col-xs-11">
                    <h3>操作说明</h3>
                    <p>
                        1.这里显示你代理的任务（当别人把任务代理给你的时候）。
                    </p>
                    <p>
                        2.点击需要处理的业务，进入待处理列表。
                    </p>
                    <p>
                        3.对相应的业务进行审批操作。
                    </p>

                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var scripts = [null, "/Scripts/Workflow/workflow.js", null]
    $('.page-content-area').ace_ajax('loadScripts', scripts, function () {
        jQuery(function ($) {
            $(document).one('ajaxloadstart.page', function (e) {
                //$(document).off(ace.click_event, '.dropdown-menu>li');
            })
            $(".bizprocess li>a").on(ace.click_event, function () {
                var $this = $(this);
                var business = $this.data("business");
                var billTable = $this.data("bill");
                $("#bizContent").empty();
                NProgress.start();
                $.get(basePath + "/Workflow/Business/Approval?businessUid=" + business + "&billTable=" + billTable + "&agent=1", function (content) {
                    $("#bizContent").html(content);
                    //完毕重新设置jqgrid宽度
                    $(window).triggerHandler('resize.jqGrid');
                    NProgress.done();
                })

            })
        })
    });
</script>
